Data may be sent between a transmitter and a receiver according to one of many data transfer protocols. Data transfer protocols generally include protocols defined by industry standards bodies or proprietary protocols. While the various protocols may have advantages and disadvantages, a data transmission protocol may be selected to optimize the transmission of data according to the application using the protocol. Regardless of the selected protocol, most data transmission protocols require error checking. Error checking may be an error detection protocols indicating that an error exists without identifying the location of the error. Alternatively, error correction protocols enable both error detection and correction. In either case, data representative of the data block is transmitted with the data to enable the receiver to determine whether an error exists in the data.
One example of a data transmission protocol is the User Datagram Protocol (UDP). UDP is a connectionless, packet-based data transmission protocol used in internet protocol (IP) networks, primarily for broadcasting messages over an IP network. For example, many VoIP applications use UDP for the voice data transmission. Each packet on the network is called a UDP datagram comprising of a small header and user data. Because UDP is connectionless, a datagram may be sent without advance notice, and there is no guarantee that the datagram will be delivered to the destination host. Accordingly, the application using UDP must be prepared to handle errors, including missing datagrams, such as through error detection and correction.
In order to implement the UDP standard, a checksum must be sent with the data packet. In particular, a checksum of the datagram is calculated and then placed into the header of the same packet. However, the header is located at the beginning of the packet for which the checksum is generated. Unlike most error correction/detection architectures where the checksum is located at the end of the packet or at the beginning of the next packet, the requirement that the checksum be placed in the header of the packet being transmitted creates a problem because it is not possible to calculate the checksum as the data is being transmitted. That is, by the time the checksum is obtained, the data in the location for storing the checksum will have already been sent. Accordingly, the checksum must be calculated before the packet is transmitted.
Conventional circuits implementing the UDP standard calculate a checksum while the packet is written into a first-in, first out (FIFO) memory. The checksum is calculated at this location and placed in a separate FIFO after all of the data has been loaded into the FIFO. The checksum will be read out at the correct time and replace the data coming out of the main data FIFO when the checksum timeslot is present, increasing the circuitry required to transmit the block of data including the checksum. As shown in FIG. 1 for example, separate FIFOs 102 and 104 are required to transmit data where a checksum is inserted at a location other than at the end of the data stream. The first FIFO 102 receives a write enable (Wr_En) signal and a write data (Wr_Data) signal from a circuit, such as a direct memory access (DMA) circuit 106. A Transmit Checksum block 108 also receives the Wr_En signal and the Wr_Data signal in order to generate an error detection value comprising a checksum to be used by the receiver to determine the presence of an error. The transmit checksum block 108 may then transmit a sideband write enable (SB_Wr_En) signal and sideband data (SB_Data) comprising a checksum. Because there is no means to write to the FIFO 102 other than on a first in, first out basis, the checksum must be stored in the separate FIFO 104. A control circuit 110 couples a select signal to a multiplexer 112 to select the output of one of the FIFOs 102 and 104. Accordingly, the control circuit and multiplexer enables the transmission of the checksum at a location other than at the end of the data stream using two separate FIFOs. For example, the output of FIFO 104 containing the checksum may be transmitted at the beginning the block of data for which the checksum is calculated.
However, the use of a separate FIFO has a number of disadvantages. For example, the FIFO holding the checksum is not trivial in size. Some form of RAM to hold the data and full read and write pointers would be required. A state machine would also be required to read the checksum and insert the checksum into the data stream. In designing for the worst case, the checksum FIFO depth would be nearly equal to the depth of the main data FIFO, and for a 32 bit data path, the checksum FIFO would be nearly as wide. Such a use of a checksum FIFO is an inefficient use of logic in an integrated circuit implementing a data transmission protocol. For example, in a programmable logic device where the efficient use of logic resources is important, the requirement for two FIFOs to implement the data transmission protocol is particularly inefficient.
Accordingly, there is a need for an improved circuit for and method of transmitting data.